using System;
using System.Collections.Generic;
using System.Text;
using BusinessObjects.BO_Actions.ArticleComments;
using Entity.StoreProcedure;
using BusinessObjects;
using System.Data;
namespace BusinessObjects.BO_GetObjects
{
    public static class BO_ArticleComments
    {
        public static DataTable SelectAll(int status)
        {
            try
            {
                BOArticleComments_Select_All action = new BOArticleComments_Select_All();
                usp_ArticleComments_Select_All entity = new usp_ArticleComments_Select_All();
                entity.STATUS = status;
                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable SelectTop(int rows, int status)
        {
            try
            {
                BOArticleComments_Select_Top action = new BOArticleComments_Select_Top();
                usp_ArticleComments_Select_Top entity = new usp_ArticleComments_Select_Top();
                entity.NUMBERRECORD = rows;
                entity.STATUS = status;
                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable Search(int comment_id)
        {
            try
            {
                BOArticleComments_Search action = new BOArticleComments_Search();
                usp_ArticleComments_Search entity = new usp_ArticleComments_Search();
                entity.COMMENT_ID = comment_id;
                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable SelectWithPaged(int startIndex, int pageCount, int status)
        {
            try
            {
                BOArticleComments_Select_WithPaged action = new BOArticleComments_Select_WithPaged();
                usp_ArticleComments_Select_WithPaged entity = new usp_ArticleComments_Select_WithPaged();
                entity.STARTINDEX = startIndex;
                entity.MAXRECORDS = pageCount;
                entity.STATUS = status;
                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable SelectWithPagedArticle(int startIndex, int pageCount, int status, int article)
        {
            try
            {
                BOArticleComments_Select_WithPaged_Article_id action = new BOArticleComments_Select_WithPaged_Article_id();
                usp_ArticleComments_Select_WithPaged_Article_id entity = new usp_ArticleComments_Select_WithPaged_Article_id();
                entity.STARTINDEX = startIndex;
                entity.MAXRECORDS = pageCount;
                entity.STATUS = status;
                entity.ARTICLE_ID = article;
                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static string Insert(Int64 article_id, string email, string full_name, string mobile, string address, string detail, int sort_display, DateTime created_date, DateTime modify_date, string modify_by, bool status)
        {
            try
            {
                BOArticleComments_Insert action = new BOArticleComments_Insert();
                usp_ArticleComments_Insert entity = new usp_ArticleComments_Insert();
                entity.ARTICLE_ID = article_id;
                entity.EMAIL = email;
                entity.FULL_NAME = full_name;
                entity.MOBILE = mobile;
                entity.ADDRESS = address;
                entity.DETAIL = detail;
                entity.SORT_DISPLAY = sort_display;
                entity.CREATED_DATE = created_date;
                entity.MODIFY_DATE = modify_date;
                entity.MODIFY_BY = modify_by;
                entity.STATUS = status;
                return action.ExecuteAndReturnStringValue(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static string Update(Int64 comment_id, Int64 article_id, string email, string full_name, string mobile, string address, string detail, int sort_display, DateTime created_date, DateTime modify_date, string modify_by, bool status)
        {
            try
            {
                BOArticleComments_Update action = new BOArticleComments_Update();
                usp_ArticleComments_Update entity = new usp_ArticleComments_Update();
                entity.COMMENT_ID = comment_id;
                entity.ARTICLE_ID = article_id;
                entity.EMAIL = email;
                entity.FULL_NAME = full_name;
                entity.MOBILE = mobile;
                entity.ADDRESS = address;
                entity.DETAIL = detail;
                entity.SORT_DISPLAY = sort_display;
                entity.CREATED_DATE = created_date;
                entity.MODIFY_DATE = modify_date;
                entity.MODIFY_BY = modify_by;
                entity.STATUS = status;
                return action.ExecuteAndReturnStringValue(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static bool Delete(int comment_id)
        {
            try
            {
                BOArticleComments_Delete action = new BOArticleComments_Delete();
                usp_ArticleComments_Delete entity = new usp_ArticleComments_Delete();
                entity.COMMENT_ID = comment_id;
                return action.ExecuteAndReturnBooleanValue(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static bool Restore(int comment_id)
        {
            try
            {
                BOArticleComments_Restore action = new BOArticleComments_Restore();
                usp_ArticleComments_Restore entity = new usp_ArticleComments_Restore();
                entity.COMMENT_ID = comment_id;
                return action.ExecuteAndReturnBooleanValue(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    }
}

